package router

import (
	"admin-nexus-backend/internal/handler"

	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
)

// SetupAttachmentRoutes 设置附件相关路由
func SetupAttachmentRoutes(router *gin.RouterGroup, db *gorm.DB) {
	attachmentHandler := handler.NewAttachmentHandler(db)
	attachments := router.Group("/attachments")
	{
		attachments.GET("", attachmentHandler.GetAttachmentList)                    // 获取附件列表
		attachments.GET("/:id", attachmentHandler.GetAttachment)                    // 获取附件详情
		attachments.POST("", attachmentHandler.CreateAttachment)                    // 创建附件
		attachments.PUT("/:id", attachmentHandler.UpdateAttachment)                 // 更新附件
		attachments.DELETE("/:id", attachmentHandler.DeleteAttachment)              // 删除附件
		attachments.POST("/batch-delete", attachmentHandler.BatchDeleteAttachments) // 批量删除附件
		attachments.POST("/upload", attachmentHandler.UploadFile)                   // 上传文件
		attachments.GET("/categories", attachmentHandler.GetCategories)             // 获取类别列表
		attachments.GET("/storage-engines", attachmentHandler.GetStorageEngines)    // 获取存储引擎列表
	}
}
